Erik Kusch, PhD Student
Department of Biology
Section for Ecoinformatics & Biodiversity
Center for Biodiversity Dynamics in a Changing World (BIOCHANGE)
Aarhus University
08/01/2021
[Study Group] Bayesian Statistics with the Rethinking Material 1
08/01/2021
[Study Group] Bayesian Statistics with the Rethinking Material 2
1. Variables (we want to understand these):
- Data (observed)
- Parameters (unobserved)
2. Variable Associations (the characteristics and
relationships):
- Probability distributions
- Formulae to explain variables with other variables
3. Joint Generative Model (simulate observations
and analyse real observations)
08/01/2021
[Study Group] Bayesian Statistics with the Rethinking Material 3
Regressions should only be used for
approximation!
08/01/2021
[Study Group] Bayesian Statistics with the Rethinking Material 4
Example Height ~ Weight
- Adults only
08/01/2021
[Study Group] Bayesian Statistics with the Rethinking Material 5
Uninformative priors often create impossible outcomes in
our model expectations.
08/01/2021
[Study Group] Bayesian Statistics with the Rethinking Material 6
Grid interval for average height
Grid interval for standard deviation
Grid matrix
Likelihood on log-scale
Unweighted posterior. Summation
because all elements are on log-scale
Standardising posterior
Becomes cumbersome and computationally expensive fast.
08/01/2021
[Study Group] Bayesian Statistics with the Rethinking Material 7
Quadratic approximation can make use of starting values.
08/01/2021
[Study Group] Bayesian Statistics with the Rethinking Material 8
Defining Parameters
Adding the Predictor Variable
08/01/2021
[Study Group] Bayesian Statistics with the Rethinking Material 9
“Getting the
scatter right is
important!
Naive prior for β Log-Normal prior for β
08/01/2021
[Study Group] Bayesian Statistics with the Rethinking Material 10
Load data
Select adults
Maths “=“ turns into “<-in code
08/01/2021
[Study Group] Bayesian Statistics with the Rethinking Material 11
Tracking the uncertainty
makes for more informative
results.
We are interested in the shape of the
prediction interval, not the boundaries.
08/01/2021
[Study Group] Bayesian Statistics with the Rethinking Material 12
08/01/2021
[Study Group] Bayesian Statistics with the Rethinking Material 13
Basis-Splines
Linear means additive.
We can have curved relationships in linear models via:
08/01/2021
[Study Group] Bayesian Statistics with the Rethinking Material 14
Specification
x has been centred previously! (


; scale() in R)
Standardizing predictor variables before model fitting makes
estimation easier and helps interpretation.
08/01/2021
[Study Group] Bayesian Statistics with the Rethinking Material 15
Basis-Splines
- Interpolation of localised functions possible
- Called P(enalised)-Splines in Bayesian terms
- Weights (w) are synonymous with slopes
- Basis functions (B) are synthetic variables (turn
on weights in regions of x)
- Global function defined by:
Number of knots (transitions between local
functions; usually placed at quantiles of data)
Polynomial degree of local functions
Linear means additive.
Neither are mechanistic and can exhibit strange behaviour beyond the limits of the data!
We can have curved relationships in linear models via:
08/01/2021
[Study Group] Bayesian Statistics with the Rethinking Material 16
Specification
- Basis function 4 has it’s maximum
weight here
- All other weights are 0
Matrix multiplication to sum weights
and splines